package app.common.dao;
import java.util.ArrayList;
import java.util.List;

import cn.lily.com.container.data.Record;
import cn.lily.com.exception.YaconException;
import cn.lily.esb.framework.drivers.db.bean.ControlDAO;
public class Leo_can_firm_relaBean extends ControlDAO implements Cloneable {
	private static final long serialVersionUID = 1L;
	public Leo_can_firm_relaBean() throws YaconException {
		super();
		setTableName("LEO_CAN_FIRM_RELA");
	}
	String  fcan_firm_id;
	String  fcan_detail_id;

	public void setCan_firm_id( String can_firm_id)throws YaconException{
		setFieldData("can_firm_id",can_firm_id,TEXT);
		this.fcan_firm_id=can_firm_id;
	}

	public String getCan_firm_id(){
		if ( this.fcan_firm_id == null){
			return "";
		}
		else {
			return this.fcan_firm_id;
		}
	}

	public void setCan_detail_id( String can_detail_id)throws YaconException{
		setFieldData("can_detail_id",can_detail_id,TEXT);
		this.fcan_detail_id=can_detail_id;
	}

	public String getCan_detail_id(){
		if ( this.fcan_detail_id == null){
			return "";
		}
		else {
			return this.fcan_detail_id;
		}
	}

	public  List<Leo_can_firm_relaBean> findListBeans(String sSqlWhere)throws YaconException {
		List<Leo_can_firm_relaBean> listBeans = new ArrayList<Leo_can_firm_relaBean>();
		findTable = findTableByWhere(sSqlWhere);
		while (findTable.next())
		{
			Leo_can_firm_relaBean fDaoBean  = new Leo_can_firm_relaBean();
			fDaoBean.fcan_firm_id = findTable.getString("can_firm_id");
			fDaoBean.fcan_detail_id = findTable.getString("can_detail_id");
			fDaoBean.operate_mode = "edit";
			listBeans.add(fDaoBean);
		}
		return listBeans;
	}

	public Leo_can_firm_relaBean findBean(String sSqlWhere)throws YaconException {
		findTable = findTableByWhere(sSqlWhere);
		if (findTable.next())
		{
			Leo_can_firm_relaBean fDaoBean  = new Leo_can_firm_relaBean();
			fDaoBean.fcan_firm_id = findTable.getString("can_firm_id");
			fDaoBean.fcan_detail_id = findTable.getString("can_detail_id");
			fDaoBean.operate_mode = "edit";
			return fDaoBean;
		}else
			return null;
	}

	public void setViewRecord(Record viewRecord) throws YaconException{
		if (viewRecord.getString("can_firm_id") != null)
			setCan_firm_id(viewRecord.getString("can_firm_id"));
		if (viewRecord.getString("can_detail_id") != null)
			setCan_detail_id(viewRecord.getString("can_detail_id"));
	}

}
